package com.sise.cn.controller;

import com.sise.cn.annotation.AccessAuthority;
import com.sise.cn.api.common.po.BaseUserPO;
import com.sise.cn.api.common.po.UserPO;
import com.sise.cn.vo.HttpBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ClassName AdminLoginController
 * @Description
 * @Author CCJ
 * @Date 2020/6/10 15:42
 **/
@RestController
@RequestMapping("/customer")
public class CustomerLoginController extends LoginController {

    @PostMapping("/register")
    public HttpBody register(@RequestBody UserPO userPO) {
        loginValidService.register(userPO);
        return HttpBody.SUCCESS;
    }

    @PostMapping("/login")
    @AccessAuthority
    public void login(@RequestBody UserPO param, HttpServletRequest request,
                      HttpServletResponse response) throws IOException {
        loginin(param, request, response, false);
    }
}
